﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Input;

namespace Kokomo.Environment.Documents
{
	/// <summary>
	/// Represents a detail link item within a summary.
	/// </summary>
	/// <seealso cref="DetailViewModel.Summary"/>
	public class SummaryDetailLinkItem : SummaryDetailItem
	{
		/// <summary>
		/// Initializes a new instance of <see cref="SummaryDetailLinkItem"/>.
		/// </summary>
		/// <param name="heading">The heading of the detail.</param>
		/// <param name="text">The text of the detail.</param>
		/// <param name="command">The command to invoke when the user clicks the link.</param>
		/// <param name="commandParameter">The parameter to pass to <paramref name="command"/>.</param>
		/// <remarks>
		/// Although the caller may specify any command, usually it should be
		/// <see cref="NavigationContext.NavigateToCommand"/>.
		/// Other commands should usually be added as a command to
		/// <see cref="SummaryViewModel"/>
		/// </remarks>
		public SummaryDetailLinkItem(
			UiString heading,
			UiString text,
			ICommand command,
			object commandParameter = null
			)
			: base(heading, text)
		{
			if (command == null) throw new ArgumentNullException("command");

			this.Command = command;
			this.CommandParameter = commandParameter;
		}

		/// <summary>
		/// Gets the command to invoke when the user clicks the link.
		/// </summary>
		public ICommand Command { get; private set; }
		/// <summary>
		/// Gets the parameter to pass to <see cref="Command"/>.
		/// </summary>
		public object CommandParameter { get; private set; }
	}
}
